<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>${fns:getConfig('productName')}</title>
	<meta name="decorator" content="blank"/>
</head>
<body class="fixed-sidebar full-height-layout gray-bg" style="overflowtaglib.jsp:hidden">
<div id="wrapper" class="up-down-layout">
	<!--顶部导航开始-->
	<nav class="navbar navbar-static-top top-nav clearfix" role="navigation">
		<!-- 首页logo -->
		<div class="navbar-header ">
			<span class="nav-header logoTitle J_menuItem " style="display: inline-block;">
				<span class="logoImg"><img src="${ownStatic}/images/page-logo.svg" alt=""/></span>
				<span class="logoTitle J_menuItem">${fns:getConfig('productName')}</span>
			</span>
		</div>

		<!--横向总导航-->
		<ul class="transverse-total-navbar clearfix">
			<c:set var="firstMenu" value="true"/>
			<c:forEach items="${fns:getMenuList()}" var="menu" varStatus="idxStatus">
				<c:if test="${menu.parent.id eq '1'&&menu.isShow eq '1'}">
					<li class="menu ${not empty firstMenu && firstMenu ? ' active' : ''}">
						<c:if test="${empty menu.href}">
							<a href="javascript:void(0);" data-href="${ctx}/sys/menu/tree?parentId=${menu.id}" data-id="${menu.id}">
								<span class="nav-label">${menu.name}</span>
							</a>
						</c:if>
						<c:if test="${not empty menu.href}">
							<a href="${fn:indexOf(menu.href, '://') eq -1 ? ctx : ''}${menu.href}" data-id="${menu.id}">
								<span class="nav-label">${menu.name}</span>
							</a>
						</c:if>
					</li>
					<c:if test="${firstMenu}">
						<c:set var="firstMenuId" value="${menu.id}"/>
					</c:if>
					<c:set var="firstMenu" value="false"/>
				</c:if>
			</c:forEach>
		</ul>

		<!-- 通知头像 -->
		<ul class="nav navbar-top-links navbar-right clearfix">
			<li class="dropdown pull-left">
				<a class="dropdown-toggle count-info J_menuItem" href="${ctx}/oa/oaNotify/self">
					<span style="display: none;">通知列表</span>
					<i class="fa icon-bell-alt"></i> <span class="label label-primary" id="notifyNum"></span>
				</a>
			</li>
			<li class="dropdown profile-element pull-left" style="height: 60px;">
				<span class="headImg"><img alt="image" class="img-circle" src="${ownStatic}/images/default_headimg.jpg"></span>
				<a data-toggle="dropdown" class="dropdown-toggle" style="height: 100%;" href="javascript:void(0);" aria-expanded="false">
                                <span class="clear">
                               <span class="block m-t-xs"><strong class="font-bold">${fns:getUser().office.name}</strong></span>
                                <span class="text-muted text-xs block">${fns:getUser().name}<b class="caret"></b></span>
                                </span>
				</a>
				<ul class="dropdown-menu animated fadeInRight m-t-xs" >
					<li>
						<a class="J_menuItem" href="${ctx}/sys/user/info" target='mainFrame'>个人信息</a>
					</li>
					<li>
						<a class="J_menuItem" href="${ctx}/sys/user/modifyPwd" target='mainFrame'>修改密码</a>
					</li>
					<li class="divider"></li>
					<li>
						<a href="${ctx}/logout">安全退出</a>
					</li>
				</ul>
			</li>
		</ul>
	</nav>
	<!--顶部导航结束-->
	<!--顶部二级导航开始-->
	<div class="second-sub-nav" id="transverse-second-nav">
		<!--左侧二级导航开始-->
		<div class="navbar-default navbar-static-side left-nav"></div>
	</div>
	<!--顶部二级导航结束-->

	<!--左侧导航开始-->
	<!--左侧总导航开始-->
	<nav class="navbar-default total-navbar close-navbar">
		<div class="sidebar-collapse">
			<div class="total-navbar-toggle">
				<i class="fa icon-reorder"></i>
			</div>
			<ul class="nav">
				<c:set var="firstMenu" value="true"/>
				<c:forEach items="${fns:getMenuList()}" var="menu" varStatus="idxStatus">
					<c:if test="${menu.parent.id eq '1'&&menu.isShow eq '1'}">
						<li class="menu ${not empty firstMenu && firstMenu ? ' active' : ''}">
							<c:if test="${empty menu.href}">
								<a href="javascript:void(0);" data-href="${ctx}/sys/menu/tree?parentId=${menu.id}" data-id="${menu.id}">
									<i class="${not empty menu.icon ? menu.icon : 'icon-th-large'}"></i>
									<span class="nav-label">${menu.name}</span>
								</a>
							</c:if>
							<c:if test="${not empty menu.href}">
								<a href="${fn:indexOf(menu.href, '://') eq -1 ? ctx : ''}${menu.href}" data-id="${menu.id}">
									<i class="${not empty menu.icon ? menu.icon : 'icon-th-large'}"></i>
									<span class="nav-label">${menu.name}</span>
								</a>
							</c:if>
						</li>
						<c:if test="${firstMenu}">
							<c:set var="firstMenuId" value="${menu.id}"/>
						</c:if>
						<c:set var="firstMenu" value="false"/>
					</c:if>
				</c:forEach>
			</ul>
		</div>
	</nav>
	<!--左侧总导航结束-->

	<!--左侧导航结束-->
	<!--右侧部分开始-->
	<div id="page-wrapper" class="gray-bg dashbard-1 true-height" style="height: calc( 100% - 60px)">
		<!--二级导航-->
		<div class="second-nav" id="second-nav">
			<!--左侧二级导航开始-->
			<div class="navbar-default navbar-static-side left-nav"></div>
		</div>
		<!--伸缩二级导航按钮-->
		<div class="display-arrow second-nav-open">
			<i class="fa icon-double-angle-left"></i>
			<i class="fa icon-double-angle-right" style="display: none;"></i>
		</div>
		<!--主体部分-->
		<div class="page-main">
			<div class="row content-tabs">
				<button class="roll-nav roll-left J_tabLeft"><i class="fa icon-backward"></i>
				</button>
				<nav class="page-tabs J_menuTabs">
					<div class="page-tabs-content">
					</div>
				</nav>
				<button class="roll-nav roll-right J_tabRight"><i class="fa icon-forward"></i>
				</button>
				<!--关闭操作-->
				<div class="btn-group roll-nav roll-right">
					<button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>
					</button>
					<ul role="menu" class="dropdown-menu dropdown-menu-right ">
						<li class="J_tabCloseAll">
							<a>关闭全部选项卡</a>
						</li>
						<li class="J_tabCloseOther">
							<a>关闭其他选项卡</a>
						</li>
					</ul>
				</div>
				<div class="roll-nav roll-right J_tabExit">
					<button class="dropdown J_tabClose" data-toggle="dropdown">布局</button>
					<ul role="menu" class="dropdown-menu dropdown-menu-right layout-dropdown">
						<li class="J_tabCloseAll nui-form">
							<c:forEach items="${fns:getDictList('theme')}" var="dict">
								<li class="J_tabCloseAll"><a href="#" onclick="location='${pageContext.request.contextPath}/theme/${dict.value}?url='+location.href">${dict.label}</a></li>
							</c:forEach>
						</li>
					</ul>
				</div>
			</div>
			<div class="row J_mainContent" id="content-main">
				<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="" frameborder="0" seamless></iframe>
			</div>
			<div class="footer">
				<div class="pull-right">
					Copyright &copy; 2012-${fns:getConfig('copyrightYear')} <a href="#">${fns:getConfig('productName')}</a> - Powered By <a href="${fns:getConfig('group.url')}" target="_blank">${fns:getConfig('group')}</a> ${fns:getConfig('version')}
				</div>
			</div>
		</div>
		<!---->
	</div>
	<!--右侧部分结束-->
</div>
<script>
	/*一级导航操作*/
	//上下布局导航
	function transverse_nav(){
        //上下布局下一级导航触摸事件
        var timer = null;
        var transverse_total_navbar = $('.up-down-layout .navbar-static-top');
        $('.up-down-layout .transverse-total-navbar>li>a').mouseover(function () {
            //一级导航加mouseover事件
            // 显示二级菜单
            var menuId = "#menu-" + $(this).attr("data-id");
            $(this).parent('li').addClass('active').siblings('li').removeClass('active');
            var this_offset_left = $(this).offset().left;
            // 显示二级菜单
            // 初始化展开所有二级菜单
            function all_second_nav_open() {
                $(menuId + " .accordion-body").addClass('in');
                $(menuId + " .accordion-heading a").parents('.accordion-group').addClass('accordion-group-active');
                $(menuId).siblings('.accordion').hide();
            };

            clearTimeout(timer);
            transverse_total_navbar.addClass('navbar-static-top-shadow');
            if ($(menuId).length > 0) {
                $(menuId).show();
                all_second_nav_open();
            } else {
                // 获取二级菜单数据
                $.get($(this).attr("data-href"), function (data) {
                    if (data.indexOf("id=\"loginForm\"") != -1) {
                        alert('未登录或登录超时。请重新登录，谢谢！');
                        top.location = "${ctx}";
                        return false;
                    }
                    $(".up-down-layout #transverse-second-nav .left-nav .accordion").hide();
                    $(".up-down-layout #transverse-second-nav .left-nav").append(data);
                    if ($(menuId).length > 0) {
                        $(menuId).show();
                        all_second_nav_open();
                    }

                    // 链接去掉虚框
                    $(menuId + " a").bind("focus", function () {
                        if (this.blur) {
                            this.blur()
                        }
                        ;
                    });
                    // 二级内容
                    $(menuId + " .accordion-body a").click(function () {
                        $(menuId + " li").removeClass("active");
                        $(this).parent().addClass("active");
                        //二级内容点击后，二级导航模块消失
                        $(this).parents('.accordion').hide();
                    });
                    // 展现三级
                    $(menuId + " .accordion-inner a").click(function () {
                        var href = $(this).attr("data-href");
                        if ($(href).length > 0) {
                            $(href).toggle().parent().toggle();
                            return false;
                        }
                        // <c:if test="${tabmode eq '1'}"> 打开显示页签
                        return addTab($(this)); // </c:if>
                    });
                    //定位二级带单的位置
                    $(menuId).css('padding-left',this_offset_left-40);
                    // 默认选中第一个一级菜单的第一个二级菜单
                    $('.up-down-layout .navbar-static-side .accordion:first .accordion-inner:first a:first').click();
                 
                });
            };
            $(menuId).mouseover(function(){
                clearTimeout(timer);
                $(this).show();
            }).mouseout(function(){
                clearTimeout(timer);
                timer = setTimeout(function(){
                	transverse_total_navbar.removeClass('navbar-static-top-shadow');
                    $('.up-down-layout .accordion').hide();
                },200)
            })
        }).mouseout(function () {
            clearTimeout(timer)
            timer = setTimeout(function(){
            	 transverse_total_navbar.removeClass('navbar-static-top-shadow');
                $('.up-down-layout .accordion').hide();
            },200)
        });
    	// 初始化触摸第一个一级菜单
    	$('.up-down-layout .transverse-total-navbar>li:first>a').mouseover();
    	$('.up-down-layout .transverse-total-navbar>li:first>a').mouseout();
    };

	// 获取通知数目  <c:set var="oaNotifyRemindInterval" value="${fns:getConfig('oa.notify.remind.interval')}"/>
	function getNotifyNum(){
		$.get("${ctx}/oa/oaNotify/self/count?updateSession=0&t="+new Date().getTime(),function(data){
			var num = parseFloat(data);
			if (num > 0){
				$("#notifyNum , #notifyNum2").show().html("("+num+")");
			}else{
				$("#notifyNum , #notifyNum2").hide()
			}
		});
	}
	getNotifyNum(); //<c:if test="${oaNotifyRemindInterval ne '' && oaNotifyRemindInterval ne '0'}">
	setInterval(getNotifyNum, ${oaNotifyRemindInterval}); //</c:if>
	transverse_nav(); 
</script>
</body>
</html>